<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Base_object{
	
	const BASE_OBJECT_STATUS_NEW = 1;
	const BASE_OBJECT_STATUS_DIRTY = 2;
	const BASE_OBJECT_STATUS_DELETE = 3;
	
	private $objectStatus = null;
	
	
	public function __construct($id = null){
		if(is_null($id)){
			$this->markNew();
		}
	}
	public function clearObjectStatus(){
		$this->objectStatus = null;
	}	
	public function markDirty(){
		$this->objectStatus = self::BASE_OBJECT_STATUS_DIRTY;
	}
	public function isDirty(){
		return ($this->objectStatus == self::BASE_OBJECT_STATUS_DIRTY);
	}
	public function markNew(){
		$this->objectStatus = self::BASE_OBJECT_STATUS_NEW;
	}
	public function isNew(){
		return ($this->objectStatus == self::BASE_OBJECT_STATUS_NEW);
	}
	
	public function getObjectStatus(){
		return $this->objectStatus;
	}
}